package com.example.seh.person;

import android.content.Context;

public class ListenerManager {
    private LoginListener loginListener;
    private PayListener payListener;
    private Context mContext;
    private static ListenerManager manager;

    public static ListenerManager getInstance(Context context){
        if(manager==null){
            manager = new ListenerManager(context);
        }
        return manager;
    }

    public ListenerManager(Context context){
        this.mContext =context.getApplicationContext();//使用getAppcationContext()防止单例模式内存泄漏
    }
    public void setLoginListener(LoginListener loginListener) {
        this.loginListener = loginListener;
    }

    public void setPayListener(PayListener payListener) {
        this.payListener = payListener;
    }

    public void updata() {
        if (loginListener != null) {
            loginListener.updata();
        }
    }

    public void payUpdata() {
        if (payListener != null) {
            payListener.payAndUpdata();
        }
    }
}
